package Factory;


public class Factory {
    public static void main(String[] args) {
        FactoryA factoryA = new FactoryA();
        factoryA.creatrProduct().print();
    }
}

interface abstractFactory{
    public Product1 creatrProduct();
}

class FactoryA implements abstractFactory{
    @Override
    public Product1 creatrProduct() {
        return new ProductA();
    }
}

class FactoryB implements abstractFactory{
    @Override
    public Product1 creatrProduct() {
        return new ProductB();
    }
}



abstract class Product1{
    public abstract void print();
}

class ProductA extends Product1 {
    @Override
    public void print() {
        System.out.println("A");
    }
}

class ProductB extends Product1 {
    @Override
    public void print() {
        System.out.println("B");
    }
}